#!/bin/bash
#path=/usr/local/bin/virbr1-set.sh
declare -i i=0
while [ ! -e /var/run/libvirt/libvirt-sock ];do
        sleep .5
        let i++
        if [ $i -ge 10 ];then
                echo "libvirt-sock do not exist!"
                exit 2
        fi
done
let i=0
/usr/bin/virsh net-create /etc/libvirt/qemu/networks/virnet3.xml
while [ $? -ne 0 ];do
        sleep .5
        /usr/bin/virsh net-create /etc/libvirt/qemu/networks/virnet3.xml
        let i++
        if [ $i -ge 10 ];then
                echo "net-create virnet3 failed!"
                exit 2
        fi
done